// 文章数据接口

import { request } from '@/utils/request'

// 频道分类数据获取
const getArticleCategory = () => {
    return request.get('/channels')
}

// 文章提交
const submitArticle = (params) => {
    return request.post('/mp/articles?draft=false', params)
}

// 文章数据获取
const getArticleList = (params) => {
    return request.get('/mp/articles',{
        params: params
    })
}

// 文章删除接口
const deleteArticle = (data) => {
    return request.delete(`/mp/articles/${data.id}`)
}

// 获取文章详情接口
const getArticleById = (id) => {
    return request.get(`/mp/articles/${id}`)
}


// 编辑文章接口
const editArticle = (data,id) => {
    return request.put(`/mp/articles/${id}?draft=false`, data)
}


export {
    getArticleCategory,
    submitArticle, 
    getArticleList, 
    deleteArticle,
    getArticleById,
    editArticle
}